package com.yiyuan.app.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.guaike.core.mybatis.plugins.BaseDAO;
import com.yiyuan.app.entity.po.MConfPrizeRulePO;
import com.yiyuan.app.mapper.MConfPrizeRuleMapper;
import org.springframework.stereotype.Repository;

@Repository
public class MConfPrizeRuleDAO extends BaseDAO<MConfPrizeRuleMapper, MConfPrizeRulePO> {

    public MConfPrizeRulePO findLastOne(Long prizeId) {
        LambdaQueryWrapper<MConfPrizeRulePO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MConfPrizeRulePO::getPrizeId, prizeId);
        queryWrapper.orderByDesc(MConfPrizeRulePO::getSignDay);
        queryWrapper.last("limit 0,1");
        return getBaseMapper().selectOne(queryWrapper);
    }
}
